package cn.ffcs.uec.recordsApproval.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import cn.ffcs.uec.recordsApproval.dao.AtiUserDao;
import cn.ffcs.uec.recordsApproval.model.AtiUser;
import cn.ffcs.uom.common.dao.BaseDaoImpl;
import cn.ffcs.uom.common.util.StrUtil;

@Repository("atiUserDao")
@Transactional
public class AtiUserDaoImpl extends BaseDaoImpl implements AtiUserDao {

	@Override
	public AtiUser findAtiUserByAtiUser(AtiUser atiUser) {
		if (null != atiUser) {
			StringBuilder sql = new StringBuilder(" SELECT * FROM ATI_USER T WHERE 1=1 ");
			List<Object> params = new ArrayList<Object>();
			if (!StrUtil.isNullOrEmpty(atiUser.getNo())) {
				sql.append(" AND T.NO = ? ");
				params.add(atiUser.getNo());
			}
			
			List<AtiUser> users = jdbcFindList(sql.toString(), params, AtiUser.class);
			if (null != users && users.size() > 0) {
				return users.get(0);
			}
			
		}
		return atiUser;
	}

}
